package com.sangsang.kafka.util;

import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 时间格式相关转换工具类
 *
 * @author liutangqi
 * @date 2025/1/20 17:46
 */
public class DateUtils {

    //1970-01-01 00:00:00
    private static final LocalDateTime ORIGINAL_LOCALDATETIME = LocalDateTime.of(1970, 1, 1, 0, 0, 0);
    //1970-01-01
    private static final LocalDate ORIGINAL_LOCALDATE = LocalDate.of(1970, 1, 1);


    /**
     * 将距1970-01-01多少天的时间进行格式转换
     *
     * @author liutangqi
     * @date 2025/1/20 17:50
     * @Param [days]
     **/
    public static LocalDate parseDate(Integer days) {
        return ORIGINAL_LOCALDATE.plusDays(days);
    }

    /**
     * 将距1970-01-01 00:00:00多少天的时间进行格式转换
     *
     * @author liutangqi
     * @date 2025/1/20 17:50
     * @Param [days]
     **/
    public static LocalDateTime parseDateTime(Integer days) {
        return ORIGINAL_LOCALDATETIME.plusDays(days);
    }


}
